package ystp.controller;

import jxl.Workbook;
import jxl.format.UnderlineStyle;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ystp.dao.*;
import ystp.model.Ysrenyuanfenpei;
import ystp.service.YsrenyuanfenpeiService;
import ystp.service.YsuserService;
import ystp.service.YsxiangmuService;
import ystp.support.StringHandle;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("daochuhuizong")
public class Huizongbiao {
    @Autowired
    public YsrenyuanfenpeiService ddYsrenyuanfenpeiService;
    @Autowired
    public FujianotMapper fujianotMapper;
    @Autowired
    public YsxiangmuService ysxiangmuService;
    @Autowired
    public FujiantMapper fujiantMapper;
    @Autowired
    public FujianslMapper fujianslMapper;
    @Autowired
    public FujianwMapper fujianwMapper;
    @Autowired
    public FujianqMapper fujianqMapper;
    @Autowired
    public FujianbMapper fujianbMapper;
    @Autowired
    public FujianjsMapper fujianjsMapper;
    @Autowired
    public FujiantihuanMapper fujiantihuanMapper;
    @Autowired
    public FujianyuanyanMapper fujianyuanyanMapper;
    @Autowired
    public FujianshiliuMapper fujianshiliuMapper;
    @Autowired
    public FujiankjjibenMapper fujiankjjibenMapper;
    @Autowired
    public FujiankjyuecaiMapper fujiankjyuecaiMapper;

    // 导出某个项目的汇总表
    @RequestMapping("huizongbiao")
    public void huizongbiao(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        try {
            switch (ppxiangmuleixing) {
                case "21":
                    daochuhuizongbiao1(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "22":
                    daochuhuizongbiao2(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "23":
                    daochuhuizongbiao3(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "24":
                    daochuhuizongbiao46(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "25":
                    daochuhuizongbiao5(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "26":
                    daochuhuizongbiao7(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "27":
                    daochuhuizongbiao8(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "28":
                    daochuhuizongbiao910(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "29":
                    daochuhuizongbiao111213(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "30":
                    daochuhuizongbiao14tihuan(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "31":
                    daochuhuizongbiao14yuanyan(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "32":
                    daochuhuizongbiao16(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "33":
                    daochuhuizongbiaokjjb(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "34":
                    daochuhuizongbiaokjyc(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "36":
                    daochuhuizongbiaokjwufagongying(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
                case "35":
                    daochuhuizongbiao8Pingui(request, response, ppxiangmuid, ppxiangmuleixing);// 语句
                    break; // 可选
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void daochuhuizongbiao1(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianotMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 14, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 6); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 14); // 药品名称宽度
            wsheet.setColumnView(3, 10); // 分类宽度
            wsheet.setColumnView(4, 10); // 规格宽度
            wsheet.setColumnView(5, 10); // 单位宽度
            wsheet.setColumnView(6, 24); // 医保宽度
            wsheet.setColumnView(7, 10); // 宽度
            wsheet.setColumnView(8, 10); // 宽度
            wsheet.setColumnView(9, 10); // 宽度
            wsheet.setColumnView(10, 10); // 宽度
            wsheet.setColumnView(11, 10); // 宽度
            wsheet.setColumnView(12, 10); // 宽度
            wsheet.setColumnView(13, 15); // 宽度
            wsheet.setColumnView(14, 15); // 宽度
            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(10, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(10, 1, 14, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "临床有无需求", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(14, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianotMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? ""
                                : mmPinguiMap.get("yizhixingpingjia").toString();
                        String youwuxuqiu = mmPinguiMap.get("youwuxuqiu") == null ? ""
                                : mmPinguiMap.get("youwuxuqiu").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, youwuxuqiu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao2(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianotMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 13, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 14); // 药品名称宽度
            wsheet.setColumnView(3, 14); // 分类宽度
            wsheet.setColumnView(4, 14); // 规格宽度
            wsheet.setColumnView(5, 14); // 单位宽度
            wsheet.setColumnView(6, 14); // 医保宽度
            wsheet.setColumnView(7, 14); // 宽度
            wsheet.setColumnView(8, 14); // 宽度
            wsheet.setColumnView(9, 14); // 宽度
            wsheet.setColumnView(10, 14); // 宽度
            wsheet.setColumnView(11, 14); // 宽度
            wsheet.setColumnView(12, 14); // 宽度
            wsheet.setColumnView(13, 14); // 宽度
            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(9, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(9, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianotMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? ""
                                : mmPinguiMap.get("yizhixingpingjia").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao3(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujiantMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 16, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 14); // 药品名称宽度
            wsheet.setColumnView(3, 14); // 分类宽度
            wsheet.setColumnView(4, 14); // 规格宽度
            wsheet.setColumnView(5, 14); // 单位宽度
            wsheet.setColumnView(6, 14); // 医保宽度
            wsheet.setColumnView(7, 14); // 宽度
            wsheet.setColumnView(8, 14); // 宽度
            wsheet.setColumnView(9, 14); // 宽度
            wsheet.setColumnView(10, 14); // 宽度
            wsheet.setColumnView(11, 14); // 宽度
            wsheet.setColumnView(12, 14); // 宽度
            wsheet.setColumnView(13, 14); // 宽度
            wsheet.setColumnView(14, 14); // 宽度
            wsheet.setColumnView(15, 14); // 宽度
            wsheet.setColumnView(16, 14); // 宽度
            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(12, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(12, 1, 16, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(11, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(12, 2, "申请总次数", wcfFC));
            wsheet.addCell(new Label(13, 2, "申请总数量", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(16, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiantMapper.findqianzibiaoResult(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? ""
                                : mmPinguiMap.get("yizhixingpingjia").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String shenqingzongcishu = mmPinguiMap.get("shenqingzongcishu") == null ? ""
                                : mmPinguiMap.get("shenqingzongcishu").toString();
                        String shenqingzongshuliang = mmPinguiMap.get("shenqingzongshuliang") == null ? ""
                                : mmPinguiMap.get("shenqingzongshuliang").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, shenqingzongcishu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, shenqingzongshuliang, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao46(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianslMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 9, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 32); // 宽度
            wsheet.setColumnView(2, 9); // 药品名称宽度
            wsheet.setColumnView(3, 16); // 分类宽度
            wsheet.setColumnView(4, 20); // 规格宽度
            wsheet.setColumnView(5, 22); // 单位宽度
            wsheet.setColumnView(6, 17); // 医保宽度
            wsheet.setColumnView(7, 8); // 宽度
            wsheet.setColumnView(8, 17); // 宽度
            wsheet.setColumnView(9, 17); // 宽度
            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(3, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(3, 1, 9, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(2, 2, "医保", wcfFC));
            wsheet.addCell(new Label(3, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(4, 2, "是否与集采药品重合", wcfFC));
            wsheet.addCell(new Label(5, 2, "是否与基本药品目录单方制剂重合", wcfFC));
            wsheet.addCell(new Label(6, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(7, 2, "备注", wcfFC));
            wsheet.addCell(new Label(8, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(9, 2, "表决结果（不纳入)", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianslMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? ""
                                : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String shifoujicaichonghe = mmPinguiMap.get("shifoujicaichonghe") == null ? ""
                                : mmPinguiMap.get("shifoujicaichonghe").toString();
                        String shifoujibenchonghe = mmPinguiMap.get("shifoujibenchonghe") == null ? ""
                                : mmPinguiMap.get("shifoujibenchonghe").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, shifoujicaichonghe, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, shifoujibenchonghe, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao5(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianwMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 14, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 10); // 宽度
            wsheet.setColumnView(1, 15); // 宽度
            wsheet.setColumnView(2, 17); // 药品名称宽度
            wsheet.setColumnView(3, 9); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 17); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 18); // 宽度
            wsheet.setColumnView(11, 16); // 宽度
            wsheet.setColumnView(12, 10); // 宽度
            wsheet.setColumnView(13, 15); // 院本部宽度
            wsheet.setColumnView(14, 15); // 院本部宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(7, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(7, 1, 14, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(10, 2, "是否与基本药品目录中通用名相同", wcfFC));
            wsheet.addCell(new Label(11, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(14, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianwMapper.findqianzibiaoResult(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? ""
                                : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String shifoujibenxiangtong = mmPinguiMap.get("shifoujibenxiangtong") == null ? ""
                                : mmPinguiMap.get("shifoujibenxiangtong").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 660);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shifoujibenxiangtong, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao7(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianqMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 13, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 15); // 宽度
            wsheet.setColumnView(2, 15); // 药品名称宽度
            wsheet.setColumnView(3, 9); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 23); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 9); // 宽度
            wsheet.setColumnView(11, 9); // 宽度
            wsheet.setColumnView(12, 13); // 宽度
            wsheet.setColumnView(13, 13); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(7, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(7, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(10, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianqMapper.findqianzibiaoResult(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? ""
                                : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 660);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao8(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianbMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 16, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 15); // 宽度
            wsheet.setColumnView(2, 15); // 药品名称宽度
            wsheet.setColumnView(3, 21); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 16); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 9); // 宽度
            wsheet.setColumnView(11, 11); // 宽度
            wsheet.setColumnView(12, 9); // 宽度
            wsheet.setColumnView(13, 16); // 宽度
            wsheet.setColumnView(14, 9); // 宽度
            wsheet.setColumnView(15, 9); // 宽度
            wsheet.setColumnView(16, 9); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(10, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(10, 1, 16, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(10, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(11, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(12, 2, "有无同功效品种", wcfFC));
            wsheet.addCell(new Label(13, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(16, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianbMapper.findqianzibiaoResult(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? ""
                                : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? ""
                                : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String youwutonggongxiao = mmPinguiMap.get("youwutonggongxiao") == null ? ""
                                : mmPinguiMap.get("youwutonggongxiao").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, youwutonggongxiao, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao910(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianjsMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 13, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 17); // 宽度
            wsheet.setColumnView(2, 21); // 药品名称宽度
            wsheet.setColumnView(3, 23); // 分类宽度
            wsheet.setColumnView(4, 5); // 规格宽度
            wsheet.setColumnView(5, 14); // 单位宽度
            wsheet.setColumnView(6, 20); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 11); // 宽度
            wsheet.setColumnView(11, 9); // 宽度
            wsheet.setColumnView(12, 9); // 宽度
            wsheet.setColumnView(13, 9); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(7, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(7, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "采购任务（万元）", wcfFC));
            wsheet.addCell(new Label(10, 2, "协议效期", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianjsMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? ""
                                : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, caigourenwu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, xieyixiaoqi, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao111213(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianjsMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 12, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 19); // 药品名称宽度
            wsheet.setColumnView(3, 12); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 15); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 13); // 宽度
            wsheet.setColumnView(10, 9); // 宽度
            wsheet.setColumnView(11, 20); // 宽度
            wsheet.setColumnView(12, 20); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(7, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(7, 1, 12, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "价格", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保", wcfFC));
            wsheet.addCell(new Label(9, 2, "采购任务量", wcfFC));
            wsheet.addCell(new Label(10, 2, "备注", wcfFC));
            wsheet.addCell(new Label(11, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianjsMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? ""
                                : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, caigourenwu, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao14tihuan(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujiantihuanMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 19, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 9); // 药品名称宽度
            wsheet.setColumnView(3, 9); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 14); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 14); // 宽度
            wsheet.setColumnView(10, 10); // 宽度
            wsheet.setColumnView(11, 9); // 宽度
            wsheet.setColumnView(12, 9); // 宽度
            wsheet.setColumnView(13, 9); // 宽度
            wsheet.setColumnView(14, 14); // 宽度
            wsheet.setColumnView(15, 9); // 宽度
            wsheet.setColumnView(16, 9); // 宽度
            wsheet.setColumnView(17, 9); // 宽度
            wsheet.setColumnView(18, 9); // 宽度
            wsheet.setColumnView(19, 9); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(14, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(14, 1, 19, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.mergeCells(0, 2, 0, 3);
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.mergeCells(1, 2, 1, 3);
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.mergeCells(2, 2, 2, 3);
            wsheet.addCell(new Label(3, 2, "现有目录品种(被替换)", wcfFC));
            wsheet.mergeCells(3, 2, 8, 2);
            wsheet.addCell(new Label(9, 2, "产品编码", wcfFC));
            wsheet.mergeCells(9, 2, 9, 3);
            wsheet.addCell(new Label(10, 2, "药品名称", wcfFC));
            wsheet.mergeCells(10, 2, 10, 3);
            wsheet.addCell(new Label(11, 2, "拟调整品种(替换)", wcfFC));
            wsheet.mergeCells(11, 2, 16, 2);
            wsheet.addCell(new Label(17, 2, "备注", wcfFC));
            wsheet.mergeCells(17, 2, 17, 3);
            wsheet.addCell(new Label(18, 2, "委员表决票数", wcfFC));
            wsheet.mergeCells(18, 2, 18, 3);
            wsheet.addCell(new Label(19, 2, "表决结果", wcfFC));
            wsheet.mergeCells(19, 2, 19, 3);

            wsheet.addCell(new Label(3, 3, "规格", wcfFC));
            wsheet.addCell(new Label(4, 3, "单位", wcfFC));
            wsheet.addCell(new Label(5, 3, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 3, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 3, "价格", wcfFC));
            wsheet.addCell(new Label(8, 3, "医保", wcfFC));
            wsheet.addCell(new Label(11, 3, "规格", wcfFC));
            wsheet.addCell(new Label(12, 3, "单位", wcfFC));
            wsheet.addCell(new Label(13, 3, "剂型", wcfFC));
            wsheet.addCell(new Label(14, 3, "生产企业", wcfFC));
            wsheet.addCell(new Label(15, 3, "价格", wcfFC));
            wsheet.addCell(new Label(16, 3, "医保", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 4;
            int mmpinpaiKaishihang = 4;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiantihuanMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String xyguige = mmPinguiMap.get("xyguige") == null ? ""
                                : mmPinguiMap.get("xyguige").toString();
                        String xydanwei = mmPinguiMap.get("xydanwei") == null ? ""
                                : mmPinguiMap.get("xydanwei").toString();
                        String xyjixing = mmPinguiMap.get("xyjixing") == null ? ""
                                : mmPinguiMap.get("xyjixing").toString();
                        String xyshengchanqiye = mmPinguiMap.get("xyshengchanqiye") == null ? ""
                                : mmPinguiMap.get("xyshengchanqiye").toString();
                        String xyjiage = mmPinguiMap.get("xyjiage") == null ? ""
                                : mmPinguiMap.get("xyjiage").toString();
                        String xyyibao = mmPinguiMap.get("xyyibao") == null ? ""
                                : mmPinguiMap.get("xyyibao").toString();
                        String tzguige = mmPinguiMap.get("tzguige") == null ? ""
                                : mmPinguiMap.get("tzguige").toString();
                        String tzdanwei = mmPinguiMap.get("tzdanwei") == null ? ""
                                : mmPinguiMap.get("tzdanwei").toString();
                        String tzjixing = mmPinguiMap.get("tzjixing") == null ? ""
                                : mmPinguiMap.get("tzjixing").toString();
                        String tzshengchanqiye = mmPinguiMap.get("tzshengchanqiye") == null ? ""
                                : mmPinguiMap.get("tzshengchanqiye").toString();
                        String tzjiage = mmPinguiMap.get("tzjiage") == null ? ""
                                : mmPinguiMap.get("tzjiage").toString();
                        String tzyibao = mmPinguiMap.get("tzyibao") == null ? ""
                                : mmPinguiMap.get("tzyibao").toString();
                        String caigourenwu = mmPinguiMap.get("caigourenwu") == null ? ""
                                : mmPinguiMap.get("caigourenwu").toString();
                        String xieyixiaoqi = mmPinguiMap.get("xieyixiaoqi") == null ? ""
                                : mmPinguiMap.get("xieyixiaoqi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();
                        String chanpinbianma2 = mmPinguiMap.get("beuzhu1") == null ? ""
                                : mmPinguiMap.get("beuzhu1").toString();
                        String yaopinmingcheng2 = mmPinguiMap.get("beizhu2") == null ? ""
                                : mmPinguiMap.get("beizhu2").toString();
                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, xyguige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, xydanwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, xyjixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, xyshengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, xyjiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, xyyibao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, chanpinbianma2, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yaopinmingcheng2, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, tzguige, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, tzdanwei, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, tzjixing, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, tzshengchanqiye, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, tzjiage, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, tzyibao, wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(18, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(19, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao14yuanyan(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianyuanyanMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 12, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 14); // 宽度
            wsheet.setColumnView(1, 14); // 宽度
            wsheet.setColumnView(2, 14); // 药品名称宽度
            wsheet.setColumnView(3, 14); // 分类宽度
            wsheet.setColumnView(4, 14); // 规格宽度
            wsheet.setColumnView(5, 14); // 单位宽度
            wsheet.setColumnView(6, 14); // 医保宽度
            wsheet.setColumnView(7, 14); // 宽度
            wsheet.setColumnView(8, 14); // 宽度
            wsheet.setColumnView(9, 14); // 宽度
            wsheet.setColumnView(10, 14); // 宽度
            wsheet.setColumnView(11, 14); // 宽度
            wsheet.setColumnView(12, 14); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(6, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(6, 1, 12, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "原研", wcfFC));
            wsheet.addCell(new Label(7, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(8, 2, "价格", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "备注", wcfFC));
            wsheet.addCell(new Label(11, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(12, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianyuanyanMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String yuanyan = mmPinguiMap.get("yuanyan") == null ? ""
                                : mmPinguiMap.get("yuanyan").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, yuanyan, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao16(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianshiliuMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 14, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 13); // 宽度
            wsheet.setColumnView(2, 13); // 药品名称宽度
            wsheet.setColumnView(3, 13); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 9); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 9); // 宽度
            wsheet.setColumnView(11, 13); // 宽度
            wsheet.setColumnView(12, 9); // 宽度
            wsheet.setColumnView(13, 12); // 宽度
            wsheet.setColumnView(14, 12); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(9, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(9, 1, 14, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "规格", wcfFC));
            wsheet.addCell(new Label(4, 2, "单位", wcfFC));
            wsheet.addCell(new Label(5, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(6, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(7, 2, "现价格（元）", wcfFC));
            wsheet.addCell(new Label(8, 2, "基药", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保", wcfFC));
            wsheet.addCell(new Label(10, 2, "是否治疗用药", wcfFC));
            wsheet.addCell(new Label(11, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(12, 2, "备注", wcfFC));
            wsheet.addCell(new Label(13, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(14, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianshiliuMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String chanpinbianma = mmPinguiMap.get("chanpinbianma") == null ? ""
                                : mmPinguiMap.get("chanpinbianma").toString();
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("jixing") == null ? "" : mmPinguiMap.get("jixing").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yibao = mmPinguiMap.get("yibao") == null ? "" : mmPinguiMap.get("yibao").toString();
                        String shifouzhiliaoyongyao = mmPinguiMap.get("shifouzhiliaoyongyao") == null ? ""
                                : mmPinguiMap.get("shifouzhiliaoyongyao").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibao, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, shifouzhiliaoyongyao, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiaokjjb(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujiankjjibenMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 2 / (double) 3) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 20, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 6); // 宽度
            wsheet.setColumnView(1, 11); // 宽度
            wsheet.setColumnView(2, 10); // 药品名称宽度
            wsheet.setColumnView(3, 10); // 分类宽度
            wsheet.setColumnView(4, 8); // 规格宽度
            wsheet.setColumnView(5, 7); // 单位宽度
            wsheet.setColumnView(6, 7); // 医保宽度
            wsheet.setColumnView(7, 5); // 宽度
            wsheet.setColumnView(8, 5); // 宽度
            wsheet.setColumnView(9, 11); // 宽度
            wsheet.setColumnView(10, 7); // 宽度
            wsheet.setColumnView(11, 7); // 宽度
            wsheet.setColumnView(12, 7); // 宽度
            wsheet.setColumnView(13, 9); // 宽度
            wsheet.setColumnView(14, 8); // 宽度
            wsheet.setColumnView(15, 8); // 宽度
            wsheet.setColumnView(16, 10); // 宽度
            wsheet.setColumnView(17, 7); // 宽度
            wsheet.setColumnView(18, 10); // 宽度
            wsheet.setColumnView(19, 13); // 宽度
            wsheet.setColumnView(20, 13); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(15, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(15, 1, 20, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "品种/品规限制", wcfFC));
            wsheet.addCell(new Label(5, 2, "规格", wcfFC));
            wsheet.addCell(new Label(6, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(7, 2, "单位", wcfFC));
            wsheet.addCell(new Label(8, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(9, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(10, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(11, 2, "基药", wcfFC));
            wsheet.addCell(new Label(12, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(13, 2, "15版指导原则", wcfFC));
            wsheet.addCell(new Label(14, 2, "申请总次数", wcfFC));
            wsheet.addCell(new Label(15, 2, "申请总数量", wcfFC));
            wsheet.addCell(new Label(16, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(17, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(18, 2, "备注", wcfFC));
            wsheet.addCell(new Label(19, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(20, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjjibenMapper.findqianzibiao(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? ""
                                : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String xianzhi = mmPinguiMap.get("beizhu2") == null ? ""
                                : mmPinguiMap.get("beizhu2").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("beizhu3") == null ? "" : mmPinguiMap.get("beizhu3").toString();
                        String shengchanqiye = mmPinguiMap.get("beizhu4") == null ? ""
                                : mmPinguiMap.get("beizhu4").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? ""
                                : mmPinguiMap.get("yibaoleibie").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? ""
                                : mmPinguiMap.get("yizhixingpingjia").toString();
                        String zhidaoyuanze = mmPinguiMap.get("zhidaoyuanze") == null ? ""
                                : mmPinguiMap.get("zhidaoyuanze").toString();
                        String lincaizongcishu = mmPinguiMap.get("lincaizongcishu") == null ? ""
                                : mmPinguiMap.get("lincaizongcishu").toString();
                        String lincaizongshulinag = mmPinguiMap.get("lincaizongshulinag") == null ? ""
                                : mmPinguiMap.get("lincaizongshulinag").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, xianzhi, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, zhidaoyuanze, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, lincaizongcishu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, lincaizongshulinag, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(17, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(18, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(19, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(20, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiaokjyc(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujiankjyuecaiMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 2 / (double) 3) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 13, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 7); // 宽度
            wsheet.setColumnView(1, 15); // 宽度
            wsheet.setColumnView(2, 19); // 药品名称宽度
            wsheet.setColumnView(3, 14); // 分类宽度
            wsheet.setColumnView(4, 21); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 12); // 医保宽度
            wsheet.setColumnView(7, 17); // 宽度
            wsheet.setColumnView(8, 17); // 宽度
            wsheet.setColumnView(9, 11); // 宽度
            wsheet.setColumnView(10, 11); // 宽度
            wsheet.setColumnView(11, 12); // 宽度
            wsheet.setColumnView(12, 12); // 宽度
            wsheet.setColumnView(13, 12); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(8, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(8, 1, 13, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "规格", wcfFC));
            wsheet.addCell(new Label(5, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(6, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(7, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(8, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(9, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(10, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(11, 2, "备注", wcfFC));
            wsheet.addCell(new Label(12, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(13, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjyuecaiMapper.findqianzibiaoResult(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? ""
                                : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String jixing = mmPinguiMap.get("beizhu2") == null ? "" : mmPinguiMap.get("beizhu2").toString();
                        String shengchanqiye = mmPinguiMap.get("shengchanqiye") == null ? ""
                                : mmPinguiMap.get("shengchanqiye").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? ""
                                : mmPinguiMap.get("yibaoleibie").toString();
                        String yizhixingpingjia = mmPinguiMap.get("beizhu3") == null ? ""
                                : mmPinguiMap.get("beizhu3").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiaokjwufagongying(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujiankjjibenMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 2 / (double) 3) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 16, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 10); // 宽度
            wsheet.setColumnView(2, 11); // 药品名称宽度
            wsheet.setColumnView(3, 8); // 分类宽度
            wsheet.setColumnView(4, 5); // 规格宽度
            wsheet.setColumnView(5, 6); // 单位宽度
            wsheet.setColumnView(6, 6); // 医保宽度
            wsheet.setColumnView(7, 5); // 宽度
            wsheet.setColumnView(8, 21); // 宽度
            wsheet.setColumnView(9, 5); // 宽度
            wsheet.setColumnView(10, 5); // 宽度
            wsheet.setColumnView(11, 10); // 宽度
            wsheet.setColumnView(12, 10); // 宽度
            wsheet.setColumnView(13, 10); // 宽度
            wsheet.setColumnView(14, 4); // 宽度
            wsheet.setColumnView(15, 20); // 宽度
            wsheet.setColumnView(16, 20); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(11, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(11, 1, 16, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "产品编码", wcfFC));
            wsheet.addCell(new Label(2, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(3, 2, "分类", wcfFC));
            wsheet.addCell(new Label(4, 2, "规格", wcfFC));
            wsheet.addCell(new Label(5, 2, "价格（元）", wcfFC));
            wsheet.addCell(new Label(6, 2, "单位", wcfFC));
            wsheet.addCell(new Label(7, 2, "剂型", wcfFC));
            wsheet.addCell(new Label(8, 2, "生产企业", wcfFC));
            wsheet.addCell(new Label(9, 2, "医保类别", wcfFC));
            wsheet.addCell(new Label(10, 2, "基药", wcfFC));
            wsheet.addCell(new Label(11, 2, "一致性评价", wcfFC));
            wsheet.addCell(new Label(12, 2, "15版指导原则", wcfFC));
            wsheet.addCell(new Label(13, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(14, 2, "备注", wcfFC));
            wsheet.addCell(new Label(15, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(16, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujiankjjibenMapper.findqianzibiao(ppxiangmuid, mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String chanpinbianma = mmPinguiMap.get("beuzhu1") == null ? ""
                                : mmPinguiMap.get("beuzhu1").toString();
                        String fenlei = mmPinguiMap.get("fenlei") == null ? "" : mmPinguiMap.get("fenlei").toString();
                        String xianzhi = mmPinguiMap.get("beizhu2") == null ? ""
                                : mmPinguiMap.get("beizhu2").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String jiage = mmPinguiMap.get("jiage") == null ? "" : mmPinguiMap.get("jiage").toString();
                        String danwei = mmPinguiMap.get("danwei") == null ? "" : mmPinguiMap.get("danwei").toString();
                        String jixing = mmPinguiMap.get("beizhu3") == null ? "" : mmPinguiMap.get("beizhu3").toString();
                        String shengchanqiye = mmPinguiMap.get("beizhu4") == null ? ""
                                : mmPinguiMap.get("beizhu4").toString();
                        String yibaoleibie = mmPinguiMap.get("yibaoleibie") == null ? ""
                                : mmPinguiMap.get("yibaoleibie").toString();
                        String jiyao = mmPinguiMap.get("jiyao") == null ? "" : mmPinguiMap.get("jiyao").toString();
                        String yizhixingpingjia = mmPinguiMap.get("yizhixingpingjia") == null ? ""
                                : mmPinguiMap.get("yizhixingpingjia").toString();
                        String zhidaoyuanze = mmPinguiMap.get("zhidaoyuanze") == null ? ""
                                : mmPinguiMap.get("zhidaoyuanze").toString();
                        String lincaizongcishu = mmPinguiMap.get("lincaizongcishu") == null ? ""
                                : mmPinguiMap.get("lincaizongcishu").toString();
                        String lincaizongshulinag = mmPinguiMap.get("lincaizongshulinag") == null ? ""
                                : mmPinguiMap.get("lincaizongshulinag").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, chanpinbianma, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, fenlei, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, jiage, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, danwei, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, jixing, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, shengchanqiye, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, yibaoleibie, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, jiyao, wcfFC));
                        wsheet.addCell(new Label(11, mmpinpaiKaishihang, yizhixingpingjia, wcfFC));
                        wsheet.addCell(new Label(12, mmpinpaiKaishihang, zhidaoyuanze, wcfFC));
                        wsheet.addCell(new Label(13, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(14, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(15, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(16, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

    public void daochuhuizongbiao8Pingui(HttpServletRequest request, HttpServletResponse response,
            @RequestParam("xiangmuid") String ppxiangmuid,
            @RequestParam("xiangmuleixing") String ppxiangmuleixing) {
        List<Ysrenyuanfenpei> mmUserList = ddYsrenyuanfenpeiService.findUserByXiangmuId(ppxiangmuid);
        List<Map<String, Object>> mmPinguiList = fujianbMapper.selectPingui(ppxiangmuid, 0, 9999);
        String xiangmumingcheng = ysxiangmuService.findOne(ppxiangmuid).getXiangmuname();

        Double mm = ((double) 1 / (double) 2) * mmUserList.size();
        int mmTongguopiaoshu = (int) Math.ceil(mm);

        response.reset();
        response.setContentType("application/x-download;charset=utf-8");
        OutputStream os = null;
        WritableWorkbook wbook = null;

        try {
            os = new BufferedOutputStream(response.getOutputStream());// 得到输出流的语句
            // response.getOutputStream();// 取得输出流
            response.reset();// 清空输出流
            SimpleDateFormat mmDateFormat = new SimpleDateFormat("yyyyMMdd-HHmmss");
            String wenjiantitle = xiangmumingcheng + StringHandle.tiemString(); // 文件名
            String tmptitle = xiangmumingcheng + "结果汇总表"; // 标题
            response.setHeader("Content-disposition",
                    "attachment; filename=" + new String(wenjiantitle.getBytes(), "iso8859-1") + ".xls");// 设定输出文件头
            response.setContentType("application/vnd.ms-excel");// 定义输出类型
            wbook = Workbook.createWorkbook(os); // 建立excel文件
            WritableSheet wsheet = wbook.createSheet(tmptitle, 0); // sheet名称
            // 设置excel标题
            WritableFont wfont = new WritableFont(WritableFont.ARIAL, 24, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式

            WritableCellFormat wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); // 添加边框
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);

            WritableCellFormat wcfFC3 = new WritableCellFormat(wfont);
            wcfFC3.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC3.setAlignment(Alignment.CENTRE);
            // wcfFC.setBackground(Colour.AQUA);
            Label label = new Label(0, 0, tmptitle, wcfFC3);

            WritableCellFormat cellFormat = new WritableCellFormat();
            cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
            cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
            cellFormat.setWrap(true);
            // cellFormat.setBackground(Colour.AQUA);
            cellFormat.setFont(wfont);
            label.setCellFormat(cellFormat);
            wsheet.addCell(label);
            wsheet.addCell(new Label(0, 0, tmptitle, wcfFC3));
            wsheet.addCell(new Label(7, 0, tmptitle, wcfFC));
            wsheet.setRowView(0, 800); // 第一行高度
            wsheet.setRowView(1, 600); // 第二行高度
            wsheet.mergeCells(0, 0, 10, 0); // 合并单元格(第一列的第一行和第十三列的第一行合并)
            wsheet.setColumnView(0, 9); // 宽度
            wsheet.setColumnView(1, 15); // 宽度
            wsheet.setColumnView(2, 15); // 药品名称宽度
            wsheet.setColumnView(3, 21); // 分类宽度
            wsheet.setColumnView(4, 9); // 规格宽度
            wsheet.setColumnView(5, 9); // 单位宽度
            wsheet.setColumnView(6, 16); // 医保宽度
            wsheet.setColumnView(7, 9); // 宽度
            wsheet.setColumnView(8, 9); // 宽度
            wsheet.setColumnView(9, 9); // 宽度
            wsheet.setColumnView(10, 9); // 宽度

            // 开始生成主体内容
            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            WritableFont wfont2 = new WritableFont(WritableFont.ARIAL, 8, WritableFont.BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK); // 设置表格样式
            WritableCellFormat wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);// 垂直居中
            wcfFC2 = new WritableCellFormat(wfont2);
            wcfFC2.setWrap(true);

            wsheet.addCell(new Label(10, 1, "日期:" + StringHandle.shorttiemString(), wcfFC2));
            wsheet.mergeCells(10, 1, 16, 1);

            wsheet.addCell(new Label(0, 2, "序号", wcfFC));
            wsheet.addCell(new Label(1, 2, "药品名称", wcfFC));
            wsheet.addCell(new Label(2, 2, "规格", wcfFC));
            wsheet.addCell(new Label(3, 2, "是否为新增品种", wcfFC));
            wsheet.addCell(new Label(4, 2, "有无临床需求", wcfFC));
            wsheet.addCell(new Label(5, 2, "申请科室", wcfFC));
            wsheet.addCell(new Label(6, 2, "有无同功效品种", wcfFC));
            wsheet.addCell(new Label(7, 2, "预选会意见", wcfFC));
            wsheet.addCell(new Label(8, 2, "备注", wcfFC));
            wsheet.addCell(new Label(9, 2, "委员表决票数", wcfFC));
            wsheet.addCell(new Label(10, 2, "表决结果", wcfFC));

            // 表头结束

            wfont = new jxl.write.WritableFont(WritableFont.ARIAL, 10, WritableFont.NO_BOLD, false,
                    UnderlineStyle.NO_UNDERLINE, Colour.BLACK);
            wcfFC = new WritableCellFormat(wfont);
            wcfFC.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN);
            wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE); // 设置居中对齐
            wcfFC.setAlignment(Alignment.CENTRE);
            wcfFC.setWrap(true);

            int count = mmPinguiList.size();
            int mmpinzhongKaishihang = 3;
            int mmpinpaiKaishihang = 3;

            for (int i = 0; i < count; i++) {
                Map<String, Object> mmPinzhongMap = mmPinguiList.get(i);

                String mmPinzhongOne = mmPinzhongMap.get("xuhao") == null ? "" : mmPinzhongMap.get("xuhao").toString();
                int mmHebingshu = 0;

                List<Map<String, Object>> mmPinguilist = fujianbMapper.findPinzhongByPinguiHuizong(ppxiangmuid,
                        mmPinzhongOne);
                if (mmPinguilist.size() > 0) {
                    mmHebingshu = mmPinguilist.size() - 1;
                }
                for (int j = 0; j < mmPinguilist.size(); j++) {
                    Map<String, Object> mmPinguiMap = mmPinguilist.get(j);
                    if (mmPinguiMap != null) {
                        String yaopinmingcheng = mmPinguiMap.get("yaopinmingcheng") == null ? ""
                                : mmPinguiMap.get("yaopinmingcheng").toString();
                        String guige = mmPinguiMap.get("guige") == null ? "" : mmPinguiMap.get("guige").toString();
                        String shifouxinzengpinzhong = mmPinguiMap.get("shifouxinzengpinzhong") == null ? ""
                                : mmPinguiMap.get("shifouxinzengpinzhong").toString();
                        String youwulinchuangxuqiu = mmPinguiMap.get("youwulinchuangxuqiu") == null ? ""
                                : mmPinguiMap.get("youwulinchuangxuqiu").toString();
                        String youwutonggongxiao = mmPinguiMap.get("youwutonggongxiao") == null ? ""
                                : mmPinguiMap.get("youwutonggongxiao").toString();
                        String yuxuanhuiyijian = mmPinguiMap.get("yuxuanhuiyijian") == null ? ""
                                : mmPinguiMap.get("yuxuanhuiyijian").toString();
                        String shenqingkeshi = mmPinguiMap.get("shenqingkeshi") == null ? ""
                                : mmPinguiMap.get("shenqingkeshi").toString();
                        String beizhu = mmPinguiMap.get("beizhu") == null ? "" : mmPinguiMap.get("beizhu").toString();

                        String piaoshu = mmPinguiMap.get("result") == null ? "" : mmPinguiMap.get("result").toString();
                        String mmbiaojueren = mmPinguiMap.get("username") == null ? ""
                                : mmPinguiMap.get("username").toString();
                        String mmyijian = "";
                        int mmpiaoshu;
                        if (mmPinguiMap.get("result") == null) {
                            mmpiaoshu = 0;
                        } else {
                            mmpiaoshu = Integer.valueOf(mmPinguiMap.get("result").toString());
                        }
                        String piaoshutext = String.valueOf(mmpiaoshu) + "/" + String.valueOf(mmUserList.size());
                        String mmJieguotext = "";

                        if (mmpiaoshu >= mmTongguopiaoshu) {
                            mmJieguotext = "通过";
                        } else {
                            mmJieguotext = "不通过";
                        }
                        wsheet.setRowView(mmpinpaiKaishihang, 700);
                        wsheet.addCell(new Label(1, mmpinpaiKaishihang, yaopinmingcheng, wcfFC));
                        wsheet.addCell(new Label(2, mmpinpaiKaishihang, guige, wcfFC));
                        wsheet.addCell(new Label(3, mmpinpaiKaishihang, shifouxinzengpinzhong, wcfFC));
                        wsheet.addCell(new Label(4, mmpinpaiKaishihang, youwulinchuangxuqiu, wcfFC));
                        wsheet.addCell(new Label(5, mmpinpaiKaishihang, shenqingkeshi, wcfFC));
                        wsheet.addCell(new Label(6, mmpinpaiKaishihang, youwutonggongxiao, wcfFC));
                        wsheet.addCell(new Label(7, mmpinpaiKaishihang, yuxuanhuiyijian, wcfFC));
                        wsheet.addCell(new Label(8, mmpinpaiKaishihang, beizhu, wcfFC));
                        wsheet.addCell(new Label(9, mmpinpaiKaishihang, piaoshutext, wcfFC));
                        wsheet.addCell(new Label(10, mmpinpaiKaishihang, mmJieguotext, wcfFC));
                        mmpinpaiKaishihang = mmpinpaiKaishihang + 1;
                    }
                }
                wsheet.addCell(new Label(0, mmpinzhongKaishihang, mmPinzhongOne, wcfFC));
                wsheet.mergeCells(0, mmpinzhongKaishihang, 0, mmpinzhongKaishihang + mmHebingshu);
                mmpinzhongKaishihang = mmpinzhongKaishihang + mmHebingshu + 1;

            }

            wbook.write(); // 写入文件
            wbook.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }

    }

}
